package cn.handy.api.service.impl;

import cn.handy.api.entity.UserEntity;
import cn.handy.api.service.IMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.val;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hanshuai
 * @Description: {}
 * @date 2019/3/22 13:50
 */
@RestController
@Api("会员服务controller")
public class MemberServiceImpl implements IMemberService {


    @Override
    @ApiOperation("调用会员服务自己的方法")
    @ApiParam(name = "name",value = "String",required = true)
    @GetMapping("/getMember")
    public UserEntity getMember(String name) {
        val userEntity = new UserEntity();
        userEntity.setName(name);
        userEntity.setAge(18);
        return userEntity;
    }

    /**
     * 测试hystrix
     * @return
     */
    @Override
    @ApiOperation("测试hystrix的方法")
    @GetMapping("/testHystrix")
    public String testHystrix() {
        System.out.println("memBer的testHystrix方法,线程名字:"+Thread.currentThread().getName());
        try {
            Thread.sleep(1500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "memBer的testHystrix方法";
    }
}
